<template>
	<view class="payContainer">
		<view class="navBarContainer">
			<view class="navBar">
				<view class="back" @click="goBack">
					<view class="iconContainer">
						<u-icon name="close" size="20"></u-icon>
					</view>
				</view>
				<text class="title">收银台</text>
				<view class="other">
					
				</view>
			</view>
		</view>
		<view class="payPrice">
			<view class="priceContainer">
				￥<view class="price">{{orderInfo.amount}}</view>
			</view>
			<view class="time">
				支付剩余时间 <view class="timeCount"><u-count-down :time="15*60*1000" format="mm:ss"></u-count-down></view>
			</view>
		</view>
		<view class="payMethod">
			<view class="weixin">
				<view class="weixinContent">
					<view class="img">
						
					</view>
					<view class="content">
						微信支付
					</view>
				</view>
				<view class="check">
					<u-icon name="checkbox-mark" color="#FFF" size="20"></u-icon>
				</view>
			</view>
		</view>
		<view class="confirmPay" @click="gotoSee">
			<view>
				确认支付￥{{orderInfo.amount}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderInfo:{}
			}
		},
		methods: {
			goBack(){
				uni.navigateBack()
			},
			gotoSee(){
				uni.request({
					url:'http://localhost:8080/kfc/user/order/payment',
					method:'put',
					header:{
						token:uni.getStorageSync('STATE_KEY').token
					},
					data:{
						orderNumber:this.orderInfo.orderNumber,
						payMethod:1
					},
					success:(res)=>{
						console.log('支付成功',res.data)
						uni.navigateTo({
							url:`./orderInfo?id=${this.orderInfo.id}`
						})
					}
				})
			}
		},
		onLoad:function(options){
			this.orderInfo=options
			console.log('订单信息',this.orderInfo)
		}
	}
</script>

<style>
	page{
		background-color: rgb(248,249,250);
	}
</style>

<style lang="scss" scoped>
	.payContainer{
		.navBarContainer{
			width: 100vw;
			height: 100rpx;
			position: fixed;
			z-index: 99;
			top:100rpx;
			left: 0;
			background-color: rgb(248,249,250);
			display: flex;
			align-items: center;
			justify-content: center;
			overflow: hidden;
			// margin-top: 30rpx;
			.navBar{
				width: 90%;
				margin: 0 auto;
				background-color: rgb(248,249,250);
				display: flex;
				align-items: center;
				justify-content: space-between;
				.back,.other{
					width: 70rpx;
				}
				.title{
					font-size: 30rpx;
				}
			}
		}
		.payPrice{
			margin-top: 200rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			.priceContainer{
				font-size: 30rpx;
				display: flex;
				align-items: flex-end;
				font-weight:600;
				.price{
					font-size: 70rpx;
					line-height: 70rpx;
				}
			}
			.time{
				color:#999999;
				font-size: 24rpx;
				margin-top: 15rpx;
				display: flex;
				align-items: center;
				.timeCount{
					margin-left: 10rpx;
				}
			}
		}
		.payMethod{
			width: 720rpx;
			margin: 0 auto;
			margin-top: 30rpx;
			background-color: #FFF;
			border-radius: 20rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			.weixin{
				width: 95%;
				display: flex;
				align-items: center;
				justify-content: space-between;
				.weixinContent{
					display: flex;
					align-items: center;
					.img{
						width: 80rpx;
						height: 60rpx;
						// background-color: aliceblue;
						background-image: url(../../static/orderMeal/wechat.png);
						background-position: center;
						background-size: contain;
						margin-top: 20rpx;
						margin-bottom: 20rpx;
					}
					.content{
						font-size: 28rpx;
						margin-left: 15rpx;
					}
				}
				.check{
					width: 40rpx;
					height: 40rpx;
					border-radius: 50%;
					border: 1px solid rgb(228,0,48);
					background-color: rgb(228,0,48);
					display: flex;
					align-items: center;
					justify-content: center;
				}
			}
		}
		.confirmPay{
			position: fixed;
			width: 720rpx;
			left: 15rpx;
			bottom: 50rpx;
			background-color: rgb(228,0,48);
			border-radius: 15rpx;
			color:#FFF;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 30rpx;
			>view{
				margin-top: 20rpx;
				margin-bottom: 20rpx;
			}
		}
	}
</style>
